package com.tuo51.evaluate.domain.evaluatingV2;

import com.starinside.wp.domain.Domain;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;

@Data
@Entity
@Table(name = "tb_evaluate_dimension_score")
@EqualsAndHashCode(callSuper = true)
public class EvaluateV2RecordDimensionScore extends Domain{

    @Column(columnDefinition = " varchar(32) COMMENT '维度id' ")
    private String dimensionId;

    @Column(columnDefinition = " varchar(50) COMMENT '维度名字' ")
    private String dimensionName;

    @Column(columnDefinition = " varchar(32) default 0 COMMENT '维度总分， 十倍, 废弃' ")
    private Integer score = 0;

    @Column(columnDefinition = " varchar(32) default 0 COMMENT '维度发育商， 十倍' ")
    private Integer dq = 0;

    @Column(columnDefinition = " varchar(32) default 0 COMMENT '维度智龄， 十倍' ")
    private Integer month = 0;

    @Column(columnDefinition = " varchar(32) COMMENT '最后一个通过的问题' ")
    private String lastPassedId;

    @Column(columnDefinition = " varchar(32) COMMENT '维度是否完结' ")
    private Boolean finished;

    @Column(columnDefinition = "varchar(32) default '' COMMENT '测评记录的id'")
    private String recordId;

    @Column(columnDefinition = "varchar(32) default 0 COMMENT '连续未通过计数器'")
    private Integer unpassCount = 0;

//    @ManyToOne
//    @JoinColumn(name = "recordId",columnDefinition = "varchar(32) default '' COMMENT '测评记录的id'")
//    @JsonIgnore
//    private EvaluateV2Record record;

    public static EvaluateV2RecordDimensionScore of(String recordId, String dimensionId, String dimensionName, Integer score, String lastPassedId, Boolean finished) {
        EvaluateV2RecordDimensionScore ret = new EvaluateV2RecordDimensionScore();
        ret.recordId = recordId;
        ret.dimensionId = dimensionId;
        ret.dimensionName = dimensionName;
        ret.score = score;
        ret.lastPassedId = lastPassedId;
        ret.finished = finished;
        return ret;
    }
}
